from selenium import webdriver
import time
from selenium.webdriver.common.by import By

# 实例化，最大化打开窗口
from selenium.webdriver.support.select import Select

driver = webdriver.Chrome()
driver.maximize_window()
driver.get('http://192.168.4.138/ecshop/admin/')

# 登录账号
driver.find_element(By.NAME, 'username').send_keys('dengrui')
driver.find_element(By.NAME, 'password').send_keys('dr123456')
driver.find_element(By.CLASS_NAME, 'button').click()

# 选择商品管理，订单管理
driver.switch_to.frame('menu-frame')   #进入frame
driver.find_element_by_xpath('//ul[@id="menu-ul"]/li[3]').click()
driver.find_element_by_xpath('//ul[@id="menu-ul"]/li[3]/ul/li[2]/a').click()
driver.switch_to.default_content()
time.sleep(2)

#订单查询
driver.switch_to.frame('main-frame')
driver.find_element_by_id('order_sn').send_keys('2021070258363')
driver.find_element_by_id('query').click()
time.sleep(2)

# 确定订单
driver.find_element(By.LINK_TEXT, '查看').click()
time.sleep(2)
driver.find_element(By.NAME, 'confirm').click()
time.sleep(4)




time.sleep(5)
#关闭窗口
driver.quit()